
DEFINE VAR nobom AS CHARACTER  FORMAT 'X(8)'.
DEFINE VAR qtyoh AS DECIMAL.

define var des LIKE pt_desc1  format 'X(80)'.
define stream a.

OUTPUT TO C:\pt_part_nobom.txt.
nobom=''.

FOR EACH pt_mstr WHERE pt_pm_code = 'p'NO-LOCK:
    
    FIND FIRST ps_mstr WHERE ps_comp = pt_part NO-LOCK NO-ERROR.
    IF NOT AVAILAB(ps_mstr) THEN DO:

       FIND FIRST pts_det WHERE pts_sub_part = pt_part NO-LOCK NO-ERROR.
       IF NOT AVAILAB(pts_det) THEN 
          nobom = 'no bom'.
    END.

    qtyoh = 0.
    FOR EACH in_mstr WHERE in_part = pt_part NO-LOCK :
        qtyoh = qtyoh + in_qty_oh.
    END.

    des = pt_desc1 + pt_desc2.
    IF nobom <> '' AND pt_abc = 'D' THEN  
       DISP pt_part pt_status pt_abc pt_group qtyoh nobom des
       
       WITH STREAM-IO WITH WIDTH 200.

    nobom = ''.

end.

OUTPUT CLOSE.
